package pcb.models.vo 
{
	import flash.utils.Dictionary;
	
	/**
	 * ...
	 * @author Fintan Boyle
	 */
	public class LessonPart implements ILessonPart,IPage 
	{
		
		public static const EXTERNAL_SWF_SET:String = "external_swf_set";
		public static const SINGLE_SWF_FRAME_SEQUENCE:String = "single_swf_frame_sequence";
		
		private var _id:String;
		private var _title:String;
		private var _loaded:Boolean;
		private var _compositionType:String;
		private var _startPage:IPage;
		private var _endPage:IPage;

		/**
		 * stores a list of ILessonPart objects with an index value corresponding to id in source xml file
		 */
		private var _slides:Dictionary;
		
		private var _slideIds:Array;
		
		
		public function LessonPart(id:String="",title:String="",compositionType:String=SINGLE_SWF_FRAME_SEQUENCE,loaded:Boolean=false) 
		{
			_id = id;
			_title = title;
			_compositionType = compositionType;
			this.setLoaded(loaded);
			//_pageType = PageTypes.LESSON_PART;
			
			_slides = new Dictionary(true);
			_slideIds = new Array();
			
		}
		
		/* INTERFACE pcb.models.vo.IPage */
		
		public function getId():String
		{
			return _id;
		}
		
		public function setId(id:String):void
		{
			_id = id;
		}
		
		public function getTitle():String
		{
			return _title;
		}
		
		public function setTitle(title:String):void
		{
			_title = title;
		}
		
		public function isLoaded():Boolean
		{
			return _loaded;
		}
		
		public function setLoaded(boo:Boolean):void
		{
			_loaded = boo;
			
			//TODO dispatch Event.LOADED here if true
		}
		
		public function getPageType():String {
			return PageTypes.NONE;
		}
		
		//public function setPageType(pageType:String):void { }
		
		
		
		/* INTERFACE pcb.models.vo.ISection */
		
		public function getCompositionType():String 
		{
			return _compositionType;
		}
		
		public function setCompositionType(type:String):void
		{
			_compositionType = type;
		}
		
		
		public function getSlideById(id:String):ISlide
		{
			return _slides[id];
		}
		
		/**
		 * Adds a ISlide object to Section's dictionary of ISlides
		 * @param	id  corresponds to id attribute of slide node in xml
		 * @param	slide a value object for a slide
		 */
		public function addSlide(id:String, slide:ISlide):void
		{
			_slides[id] = slide;
			_slideIds.push(id);
		}
		
		public function hasStartPage():Boolean
		{
			//TODO
			return true;
		}
		
		public function setHasStartPage(boo:Boolean):void
		{
			//TODO
		}
		
		
		public function hasEndPage():Boolean
		{
			//TODO
			return true;
		}
		
		public function setHasEndPage(boo:Boolean):void
		{
			//TODO
		}
		
		public function getStartPage():IPage
		{
			return _startPage;
		}
		
		public function setStartPage(page:IPage):void
		{
			_startPage = page;
		}
		
		public function getEndPage():IPage
		{
			return _endPage;
		}
		
		public function setEndPage(page:IPage):void
		{
			_endPage = page;
		}
		
		public function get slideIds():Array { return _slideIds; }
		
		public function getContainerId():String
		{
			return "mainTimeline"
		}
		
		public function setContainerId(id:String):void
		{
			
		}
		
	}
	
}